void rotate(int* nums, int numsSize, int k) {
    int newarr[numsSize];
    for (int i = 0; i < numsSize; i++)
    {
        newarr[(i + k) % numsSize] = nums[i];
    }
    for (int i = 0; i < numsSize; i++)
    {
        nums[i] = newarr[i];
    }
}